home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Networking / OTLLCTest / OTLLCTest.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  6.0 KB  |  199 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        OTLLCTest.h
  3.  
  4.     Contains:    headers, defines for the OTLLCTest.c file
  5.  
  6.     Written by: Rich Kubota    
  7.  
  8.     Copyright:    Copyright © 1993-1999 by Apple Computer, Inc., All Rights Reserved.
  9.  
  10.                 You may incorporate this Apple sample source code into your program(s) without
  11.                 restriction. This Apple sample source code has been provided "AS IS" and the
  12.                 responsibility for its operation is yours. You are not permitted to redistribute
  13.                 this Apple sample source code as "Apple sample source code" after having made
  14.                 changes. If you're going to re-distribute the source, we require that you make
  15.                 it clear in the source that the code was descended from Apple sample source
  16.                 code, but that you've made changes.
  17.  
  18.     Change History (most recent first):
  19.                 7/22/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  20.                 
  21.  
  22. */
  23. #ifndef __OTLLCTEST__
  24. #define __OTLLCTEST__
  25.  
  26.  
  27. #ifndef __CONDITIONALMACROS__
  28. #include <ConditionalMacros.h>
  29. #endif
  30.  
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34.  
  35. #if PRAGMA_ALIGN_SUPPORTED
  36. #pragma options align=mac68k
  37. #endif
  38.  
  39. #if PRAGMA_IMPORT_SUPPORTED
  40. #pragma import on
  41. #endif
  42.  
  43. #include <stdio.h>
  44. #include <Types.h>
  45. #include <Memory.h>
  46. #include <Resources.h>
  47. #include <Events.h>
  48. #include <OpenTransport.h>            // open transport files            
  49. #include <OpenTptLinks.h>
  50.  
  51.  
  52. // defines for setting and reading the data buffer
  53. #define DATASIZE    1500
  54. #define DATASLOP    50        // extra bytes for the incoming data buffer to hold
  55.                             // mentat raw mode header and ethernet header
  56. #define DATAOFFSET    1400    // first byte in data buffer where we place valid data
  57.  
  58. #define    SENDCOUNT    10005    // number of data packets to send
  59. #define TRIGGEREND    10000    // trigger point for receiver to end
  60.  
  61. // define the DSAP
  62. //#define TESTSAP        0x00FF
  63. #define TESTSAP        0xE0
  64. //#define TESTSAP        0xAA
  65.  
  66. #define  MYSNAP0    0x00
  67. #define  MYSNAP1    0x00
  68. #define  MYSNAP2    0x0C
  69. #define  MYSNAP3    0x20
  70. #define  MYSNAP4    0x00
  71.  
  72. #define TIMEOUT        30         // seconds
  73. // define the multicast address to use
  74. #define MCASTADDR0    0x09
  75. #define MCASTADDR1    0x00
  76. #define MCASTADDR2    0x2B
  77. #define MCASTADDR3    0x00
  78. #define MCASTADDR4    0x00
  79. #define MCASTADDR5    0x04
  80.  
  81. // defines for gFlags bits
  82. #define OTActiveFlag    0
  83. #define EPActiveFlag    1
  84. #define EPBoundFlag        2
  85. #define MCastActiveFlag    3
  86. #define    WantDataFlag    4
  87. #define StillBindFlag    5
  88. #define    FlowErrFlag        7
  89. #define FlowClrFlag        8
  90. #define AckSendsFlag    9
  91. #define UseAckSendsFlag    10
  92. #define WaitOptMgmtFlag    11
  93. #define RawModeFlag        12
  94. #define UseRawModeFlag    13
  95. #define SysTaskSendFlag    14
  96.  
  97.  
  98. // gFlags macros for setting, testing and clearing the flag bits
  99. #define SetOTActiveFlag(flags)        (flags |= 1 << OTActiveFlag)
  100. #define ClrOTActiveFlag(flags)        (flags &= (-1 ^ (1 << OTActiveFlag)))
  101. #define TstOTActiveFlag(flags)        ((flags & (1 << OTActiveFlag)) != 0)
  102.  
  103. #define SetEPActiveFlag(flags)        (flags |= 1 << EPActiveFlag)
  104. #define ClrEPActiveFlag(flags)        (flags &= (-1 ^ (1 << EPActiveFlag)))
  105. #define TstEPActiveFlag(flags)        ((flags & (1 << EPActiveFlag)) != 0)
  106.  
  107. #define SetEPBoundFlag(flags)        (flags |= 1 << EPBoundFlag)
  108. #define ClrEPBoundFlag(flags)        (flags &= (-1 ^ (1 << EPBoundFlag)))
  109. #define TstEPBoundFlag(flags)        ((flags & (1 << EPBoundFlag)) != 0)
  110.  
  111. #define SetMCastActiveFlag(flags)    (flags |= 1 << MCastActiveFlag)
  112. #define ClrMCastActiveFlag(flags)    (flags &= (-1 ^ (1 << MCastActiveFlag)))
  113. #define TstMCastActiveFlag(flags)    ((flags & (1 << MCastActiveFlag)) != 0)
  114.  
  115. #define SetWantDataFlag(flags)        (flags |= 1 << WantDataFlag)
  116. #define ClrWantDataFlag(flags)        (flags &= (-1 ^ (1 << WantDataFlag)))
  117. #define TstWantDataFlag(flags)        ((flags & (1 << WantDataFlag)) != 0)
  118.  
  119. #define SetStillBindFlag(flags)        (flags |= 1 << StillBindFlag)
  120. #define ClrStillBindFlag(flags)        (flags &= (-1 ^ (1 << StillBindFlag)))
  121. #define TstStillBindFlag(flags)        ((flags & (1 << StillBindFlag)) != 0)
  122.  
  123. #define SetFlowErrFlag(flags)        (flags |= 1 << FlowErrFlag)
  124. #define ClrFlowErrFlag(flags)        (flags &= (-1 ^ (1 << FlowErrFlag)))
  125. #define TstFlowErrFlag(flags)        ((flags & (1 << FlowErrFlag)) != 0)
  126.  
  127. #define SetFlowClrFlag(flags)        (flags |= 1 << FlowClrFlag)
  128. #define ClrFlowClrFlag(flags)        (flags &= (-1 ^ (1 << FlowClrFlag)))
  129. #define TstFlowClrFlag(flags)        ((flags & (1 << FlowClrFlag)) != 0)
  130.  
  131. #define SetAckSendsFlag(flags)        (flags |= 1 << AckSendsFlag)
  132. #define ClrAckSendsFlag(flags)        (flags &= (-1 ^ (1 << AckSendsFlag)))
  133. #define TstAckSendsFlag(flags)        ((flags & (1 << AckSendsFlag)) != 0)
  134.  
  135. #define SetUseAckSendsFlag(flags)    (flags |= 1 << UseAckSendsFlag)
  136. #define ClrUseAckSendsFlag(flags)    (flags &= (-1 ^ (1 << UseAckSendsFlag)))
  137. #define TstUseAckSendsFlag(flags)    ((flags & (1 << UseAckSendsFlag)) != 0)
  138.  
  139. #define SetWaitOptMgmtFlag(flags)    (flags |= 1 << WaitOptMgmtFlag)
  140. #define ClrWaitOptMgmtFlag(flags)    (flags &= (-1 ^ (1 << WaitOptMgmtFlag)))
  141. #define TstWaitOptMgmtFlag(flags)    ((flags & (1 << WaitOptMgmtFlag)) != 0)
  142.  
  143. #define SetRawModeFlag(flags)        (flags |= 1 << RawModeFlag)
  144. #define ClrRawModeFlag(flags)        (flags &= (-1 ^ (1 << RawModeFlag)))
  145. #define TstRawModeFlag(flags)        ((flags & (1 << RawModeFlag)) != 0)
  146.  
  147. #define SetUseRawModeFlag(flags)    (flags |= 1 << UseRawModeFlag)
  148. #define ClrUseRawModeFlag(flags)    (flags &= (-1 ^ (1 << UseRawModeFlag)))
  149. #define TstUseRawModeFlag(flags)    ((flags & (1 << UseRawModeFlag)) != 0)
  150.  
  151. #define SetSysTaskSendFlag(flags)    (flags |= 1 << SysTaskSendFlag)
  152. #define ClrSysTaskSendFlag(flags)    (flags &= (-1 ^ (1 << SysTaskSendFlag)))
  153. #define TstSysTaskSendFlag(flags)    ((flags & (1 << SysTaskSendFlag)) != 0)
  154.  
  155. #define kInSendPacketBit    0x01
  156.  
  157. enum {
  158.     kSendTest = 1,
  159.     kReceiveTest,
  160.     kAcceptOption,
  161.     kDeclineOption,
  162.     kQuitTest
  163. } TestTypes;
  164.  
  165. struct Address8022 {
  166.     OTAddressType    fAddrFamily;
  167.     UInt8            fHWAddr[k48BitAddrLength];
  168.     UInt16            fSAP;
  169. };
  170. typedef struct Address8022 Address8022;
  171.  
  172. struct PacketBuffer {
  173.     UInt32                rawModeOffset;
  174.     UInt32                i;
  175.     UInt32                lastFlowErrPacketNum;
  176.     TUnitData            unitdata;
  177.     struct T8022Address    dAddr;
  178.     UInt8                data[DATASIZE+32];
  179. };
  180.  
  181. typedef struct PacketBuffer PacketBuffer;
  182. typedef struct PacketBuffer *PacketBufPtr;
  183.  
  184.  
  185.  
  186. #if PRAGMA_IMPORT_SUPPORTED
  187. #pragma import off
  188. #endif
  189.  
  190. #if PRAGMA_ALIGN_SUPPORTED
  191. #pragma options align=reset
  192. #endif
  193.  
  194. #ifdef __cplusplus
  195. }
  196. #endif
  197.  
  198. #endif /* __OTLLCTEST__ */
  199.